<?php 
require_once ROOT_PATH . '/lib/models/hrfunct/EmpInfo.php';
$empList = EmpInfo::getEmpSkillInfo();
?>
<h2><?php echo "Skill Matrix"; ?><hr/></h2>
<form id="frmCancelLeave" name="frmCancelLeave" method="post" action="">
<table border="0" cellpadding="0" cellspacing="0">
   <thead>
  	<tr>
		<th class="tableTopLeft"></th>    	
    	<th class="tableTopMiddle" ></th>
    	<th class="tableTopMiddle" ></th>
    		<? for($i=0; $i<count($empList)*4;$i++){ ?>
    			<th class="tableTopMiddle" ></th>
		<?php } ?>                	
		<th class="tableTopRight"></th>
	</tr>
	
	<tr>
		<th class="tableMiddleLeft"></th>		
    	<th class="tableMiddleMiddle" rowspan="2" ><?php echo "Group"; ?></th>
    	<th class="tableMiddleMiddle" rowspan="2" style="width: 250px;" ><?php echo "Skill Expertise"; ?></th>
    		<? for($i=0; $i<count($empList);$i++){ ?>
    			<th class="tableMiddleMiddle" colspan="4">
    				<?php echo $empList[$i][1]." ".$empList[$i][4]." ".$empList[$i][3]; ?>    					
    			</th>
		<?php } ?>		
		<th class="tableMiddleRight"></th>
	</tr>
	<tr>
	<th class="tableMiddleLeft"></th>		
	<? for($j=0; $j<count($empList);$j++){ ?>
    			<th class="tableMiddleMiddle" >
    				    <1<!--  <span style="-moz-transform: rotate(-90deg);" ><1</span>-->					
    			</th>
    			<th class="tableMiddleMiddle" >
    				    1-3<!-- <span style="-moz-transform: rotate(-90deg);" >	1->3</span>-->					
    			</th>
    			<th class="tableMiddleMiddle" >
    				    3-5<!-- <span style="-moz-transform: rotate(-90deg);" >	3->5</span>		-->				
    			</th>
    			<th class="tableMiddleMiddle" >
    				     >5<!-- <span style="-moz-transform: rotate(-90deg);" > >5	</span>				-->
    			</th>
		<?php } ?>
		<th class="tableMiddleRight"></th>
	</tr>		
	
  </thead>
  
  
  <tbody>
  <?php if (is_array($records) && count($records)>0) { 
  	for($m=0;$m<count($records);$m++) {
  		$record = $records[$m];
  		$skillExpertises = $record->getSkillExpertise($record->getId());
  		if(count($skillExpertises)>0){
  		$skillExpertise1 = $skillExpertises[0]; 	
  	?>		
  <tr>
	<td class="tableMiddleLeft" rowspan="<?php echo count($skillExpertises); ?>"></td>  
    <td rowspan="<?php echo count($skillExpertises); ?>"><?php echo $record->getSkillGroupName(); ?></td>
    
    <td style="width: 300px;"><?php echo $skillExpertises[0]->getSkillExpertiseName(); ?></td>    
        <?php  for($k=0; $k<count($empList);$k++){ ?> 
            <td>
            	<?php echo $skillExpertise1->getUserSkills($skillExpertise1->getId(),$empList[$k][0],1)?"*":'' ;  ?>
            </td>            
            <td>
            	<?php echo $skillExpertise1->getUserSkills($skillExpertise1->getId(),$empList[$k][0],2)?"*":'' ;  ?>
            </td>
            <td>
            	<?php echo $skillExpertise1->getUserSkills($skillExpertise1->getId(),$empList[$k][0],3)?"*":'' ;  ?>
            </td>
            <td>
            	<?php echo $skillExpertise1->getUserSkills($skillExpertise1->getId(),$empList[$k][0],4)?"*":'' ;  ?>
            </td>
            <?php } ?>
 </tr>
  <? 
  if(count($skillExpertises)>1){
  for($n=1;$n<count($skillExpertises);$n++){
  	 $skillExpertise = $skillExpertises[$n];
  ?>   
  <tr>
    <td><?php echo $skillExpertises[$n]->getSkillExpertiseName(); ?></td>
    <?php  for($l=0; $l<count($empList);$l++){ ?> 
    <td>
    <?php echo $skillExpertise->getUserSkills($skillExpertise->getId(),$empList[$l][0],1)?"*":'' ;  ?>
    </td>
    <td>
    <?php echo $skillExpertise->getUserSkills($skillExpertise->getId(),$empList[$l][0],2)?"*":'' ;  ?>	
    </td>
    <td>
    <?php echo $skillExpertise->getUserSkills($skillExpertise->getId(),$empList[$l][0],3)?"*":'' ;  ?>
    </td>
    <td>
    <?php echo $skillExpertise->getUserSkills($skillExpertise->getId(),$empList[$l][0],4)?"*":'' ;  ?>
    </td>
    <?php } ?>

  </tr>
<?php } 
  }
?>
  
  <?php } 
  	}
  }
  ?>
  
  </tbody>
 
  <tfoot>
  	<tr>
		<td class="tableBottomLeft"></td>
		<td class="tableBottomMiddle"></td>
		<td class="tableBottomMiddle"></td>	
			<? for($i=0; $i<count($empList)*4;$i++){ ?>
    			 	<td class="tableBottomMiddle"></td>	
		<?php } ?>				
		<td class="tableBottomRight"></td>
	</tr>
  </tfoot>
  
</table>

